const crypto = require('crypto')

let password = 'i love you'

const hash = crypto.createHash('sha256')
hash.update(password)
console.log(hash.digest('hex'));


// 换一种写法
const hash2 = crypto
  .createHash('sha256')
  .update(password)
  .digest('hex');

console.log(hash2);